//
//  EmoticonCollectionViewCell.swift
//  表情键盘
//
//  Created by 付建国 on 2016/10/20.
//  Copyright © 2016年 sher. All rights reserved.
//

import UIKit

class EmoticonCollectionViewCell: UICollectionViewCell {
    // MARK:- 自定义属性
    var emoticon : Emoticon?{
        didSet{
            guard let emoticon = emoticon else {
                return
            }
            //设置cell内容
            emoticonBtn.setImage(UIImage.init(contentsOfFile: emoticon.pngPath ?? ""), for: .normal)
            emoticonBtn.setTitle(emoticon.emojiCode, for: .normal)
            //设置删除按钮
            if emoticon.isRemove{
                emoticonBtn.setImage(UIImage.init(named: "compose_emotion_delete"), for: .normal)
            }
        }
    }
    
    // MARK:- 懒加载
    fileprivate lazy var emoticonBtn : UIButton = UIButton()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    
}

extension EmoticonCollectionViewCell{
    fileprivate func setupUI(){
        contentView.addSubview(emoticonBtn)
        emoticonBtn.frame = contentView.frame
        emoticonBtn.isUserInteractionEnabled = false
        emoticonBtn.titleLabel?.font = UIFont.systemFont(ofSize: 32)
    }
}







